home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48_1 / ipdldemo.exe / lha / LOOKUP.APP < prev    next >
Text File  |  1991-02-27  |  2KB  |  57 lines

  1. // HP 48 Program Development Link Application
  2. //
  3. /Angle Degrees
  4. /FractionMark .
  5. /InstallDir
  6. /AutoExec
  7. //
  8. /Var DataList
  9. @ Order of data is:
  10. @ { "Name"           "Occupation"         "Company" }
  11. {
  12.   { "HOLLY WOOD"     "Starlet"            "Twinkle Twinkle Productions" }
  13.   { "G.O. THERMAL"   "Energy Consultant"  "Esteamed Enterprises" }
  14.   { "RICH FOODZ"     "Dietitian"          "Waist Away" }
  15.   { "CLAIRE VOYANT"  "Financial Advisor"  "Sellum and Howe" }
  16.   { "ADAM SPLITTER"  "Scientist"          "Con-Fusion Research" }
  17. }
  18. //
  19. /Var GetCo
  20. @ { "Name" \-> "Company" }
  21. \<<
  22.   'DataList' SWAP 1 3 GetData           @ get the company name
  23. \>>
  24. //
  25. /Var GetData
  26. @ { {List} "ToFind" Field ItemNum \-> "Item" }
  27. \<<
  28.   \-> list tofind field itemnum         @ save the arguments
  29.   \<<
  30.     0                                   @ initialize the success flag
  31.     1 list RCL SIZE
  32.     FOR i                               @ for each element in the list...
  33.       list i GET                        @ get the element
  34.       IF
  35.         DUP field GET tofind SAME       @ if it matches the specified field...
  36.       THEN
  37.         itemnum GET                     @ ...then get the desired item...
  38.         SWAP DROP 1                     @ ...signal success...
  39.         9E499 'i' STO                   @ ...and quit searching
  40.       ELSE
  41.         DROP
  42.       END
  43.     NEXT
  44.     IF
  45.       NOT                               @ if the item wasn't found...
  46.     THEN
  47.       tofind " Not Found" +             @ ...then signal not found
  48.     END
  49.   \>>
  50. \>>
  51. //
  52. /Var GetOcc
  53. @ { "Name" \-> "Occupation" }
  54. \<<
  55.   'DataList' SWAP 1 2 GetData           @ get the occupation
  56. \>>
  57.